<!DOCTYPE html>
<html>
    
    <script type="text/javascript">
        function callJsAlert() {
            alert('Objective-C call js to show alert');
            
            window.webkit.messageHandlers.AppModel.postMessage({body: 'call js alert in js'});
        }
    
    
    function abc() {
        
    }
    </script>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8">
            <script language="javascript">



            //JS执行window.webkit.messageHandlers.Share.postMessage(<messageBody>)
            function shareClick() {
                window.webkit.messageHandlers.shareWeixinInfo.postMessage({content:'测试分享的内容'});
            }
            
            
            //JS执行window.webkit.messageHandlers.Camera.postMessage(<messageBody>)
            function payClick() {
                window.webkit.messageHandlers.weixinPay.postMessage({eName:'大盘鸡',ePrice:'999'});
            }
            
            function QQShare() {
                window.webkit.messageHandlers.qqshare.postMessage(null);
            }
            
            //
            function callJsAlert(param) {
                window.webkit.messageHandlers.AppModel.postMessage({body: param});
            }
            
            
          </script>
    </head>
    
    <body>
        <h1>这是按钮调用</h1>
        <input type="button" value="微信分享" onclick="shareClick()" />
        <input type="button" value="微信支付" onclick="payClick()" />
        
        <input type="button" value="QQ分享" onclick="QQShare()" />
        
        <div><input type="button" value="call js alert" onclick="callJsAlert()"></div>

    </body>
</html>
